<script setup>
import { onMounted, ref, watch } from 'vue'
import { postQueryDict } from '../interface/dictApi.js'
import { configuration } from '../../env.product.js'
const Emit = defineEmits(['receiveApk'])
const data = ref({
	apkShow: true,
	apkImage: ''
})

watch(data.value, (newValue, oldValue) => {
	if (newValue.apkShow === false) {
		Emit('receiveApk', false)
	}
})
onMounted(async () => {
	postQueryDict({ id: 3 }).then((res) => {
		if (res.code === 200) {
			data.value.apkImage = configuration.visitFileUrl + res.data[0].dictImage
		}
	})
})
</script>

<template>
	<div style="position: fixed">
		<el-dialog
			v-model="data.apkShow"
			align-center
			title="APP安装包"
			width="400">
			<div class="w-full h-72 bg-base-200/80 flex justify-center items-center">
				<el-image
					:src="data.apkImage"
					class="w-56 h-56"></el-image>
			</div>
			<template #footer>
				<div class="cursor-pointer">扫码下载应用软件</div>
			</template>
		</el-dialog>
	</div>
</template>

<style scoped></style>
